﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MvcApplication1.Models;

namespace MvcApplication1.Controllers
{
    [HandleError]
    public class HomeController : Controller
    {
        public ActionResult Execute()
        {
            ViewData["Message"] = "Entity Framework Learning Lab 1";
            return View(Context.Customers.OrderBy(c => c.CompanyName));
        }

        private NorthwindEntities Context { get; set; }

        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);
            if (disposing)
            {
                Context.Dispose();
            }
        }

        protected override void Initialize(System.Web.Routing.RequestContext requestContext)
        {
            base.Initialize(requestContext);
            Context = new NorthwindEntities();
        }

        public ActionResult About()
        {
            return View();
        }

        public ActionResult FeatureRequest()
        {
            return View();
        }

        public ActionResult Index()
        {
            return View();
        }
    }
}
